from fastapi import HTTPException
from typing import Any


class BaseAPIException(HTTPException):

    status_code = 500
    detail = "服务器内部错误"
    data = None
    def __init__(self, **kwargs:Any):
        self.status_code = kwargs.get('status_code', self.status_code)
        self.detail = kwargs.get('detail', self.detail)
        self.data = kwargs.get('data', self.data)


class Failed(BaseAPIException):
    status_code = 500
    detail = '服务器异常'
    data = None


class UnAuthentication(BaseAPIException):
    status_code = 401
    detail = 'Authentication Failed'


